import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class Test {

    public static void main(String[] args) {

        System.out.println("Hello World");
        //连接本地的 Redis 服务
//        JedisPoolConfig poolConfig = new JedisPoolConfig();
//        JedisPool pool = new JedisPool();
//        Jedis jedis = pool.getResource();

        Jedis jedis = new Jedis("localhost");
        System.out.println("连接成功");

        //查看服务是否运行
        System.out.println("服务正在运行: "+jedis.ping());
        //设置 redis 字符串数据
        jedis.set("toknow", "www.toknow.top");
        // 获取存储的数据并输出
        System.out.println("redis 存储的字符串为: "+ jedis.get("toknow"));

    }

}
